feat: port to SDK v2 via concrete Protocol (typescript-sdk#1891)#614
Draft
felixweinberger wants to merge 2 commits intomainfrom
Draft
feat: port to SDK v2 via concrete Protocol (typescript-sdk#1891)#614felixweinberger wants to merge 2 commits intomainfrom
felixweinberger wants to merge 2 commits intomainfrom
Conversation
9 tasks
fee6d58 to
6247719
Compare
Ports ext-apps to @modelcontextprotocol/sdk ^2.0.0-alpha.2 using the v2 backwards-compat layer. Source delta is 4 files +44/-31; the compat layer keeps v1 deep-import paths and the ZodSchema overloads working. Unavoidable changes: - Protocol<X,Y,Z> -> Protocol<ContextT> generic-arity (events.ts) - assertCapability* override params widened to string (app.ts, app-bridge.ts) - registerAppTool callback unifies LegacyToolCallback | ToolCallback to cover both raw-shape and StandardSchema args (server/index.ts) CI will fail until @modelcontextprotocol/sdk@2.0.0-alpha.2 is published; see typescript-sdk milestone v2.0.0-bc. package-lock.json intentionally not updated in this commit.
6247719 to
d88ef47
Compare
events.ts: convert property-override arrow functions to method overrides with declared overload signatures. The overrides now expose only the ZodSchema form (the only one this package uses); a guard skips tracking during super() construction (Protocol's ctor registers built-in handlers before our fields initialize). Adds _methodOf() helper, removes the MethodSchema local type and the eslint-disable directives. server/index.ts: split registerAppTool into two public overloads (StandardSchemaWithJSON and ZodRawShape forms) matching registerTool's, removing the union-args casts. The impl signature still loses the overload pairing, so the forwarding call into registerTool uses one @ts-expect-error in place of three casts. Re-export LegacyToolCallback alongside ToolCallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE — proof-of-concept port to SDK v2 using concrete
Protocol(typescript-sdk#1891). CI is expected to fail (package.jsondepends on localfile:/tmp/*.tgzSDK builds).Supersedes #612 (the composition approach using #1846/#1868). Comparison:
app-bridge.test.tstests unmodifiedProtocolWithEventsDepends on:
Protocol)specTypeSchema)Motivation and Context
Validates that exporting concrete
Protocol(typescript-sdk#1891) yields a much smaller v2 migration than thesetCustom*/extension()path.ProtocolWithEvents extends Protocolpreserved;events.tsshim accepts v1 envelope-schema shape and forwards to v2's 3-arg form.How Has This Been Tested?
Locally: tsc 0,
npm run build0,npm test276/2/0.Breaking Changes
Same scope as #612 — see
BREAKING.md(much smaller).Types of changes
Checklist